package vn.demand.dragon.model.business
{
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.http.HTTPService;
	
	public class RemoveSupplierDelegate
	{
		private var service : HTTPService;
		private var responder : IResponder;
		
		public function RemoveSupplierDelegate(result:Function, fault:Function )
		{
			service = new HTTPService();
			service.url = "http://dev.dragon.com/index.php?m=suppliers&a=supplier_delete&suppressHeaders=1"
			service.method = 'POST';
			service.resultFormat = 'e4x';
			this.service.addEventListener(ResultEvent.RESULT, result);
			this.service.addEventListener(FaultEvent.FAULT, fault);
		}
		
		public function removeSupplier(supplierVO:Object):void {
			var token : AsyncToken = service.send(supplierVO);
			token.addResponder( responder );
			token.action = 'removeSupplier';
			token.supplierVO = supplierVO;
		}

	}
}